const fs = require("fs");
const path = require('path')
const KoaRouter = require("koa-router");

const router = new KoaRouter();

router.get("/", (ctx) => {
  ctx.body = "home";
});

fs.readdirSync(path.resolve(__dirname)).forEach(file => {
  if (file !== "index.js") {
    const route = require(`./${file}`)
    router.use(route.routes())
  }
})

module.exports = router